import Vue from "vue";
import VueRouter from "vue-router";
// 安装路由插件
Vue.use(VueRouter);
import About from "@/views/About";
import Home from "@/views/Home";
import Message from "@/views/Home/Message";
import News from "@/views/Home/News";
import Detail from "@/views/Home/Message/Detail";
// 创建一个路由
export default new VueRouter({
  mode: "history",
  routes: [
    {
      name: "guanyu",
      path: "/about",
      component: About,
    },
    {
      name: "zhuye",
      path: "/home",
      component: Home,
      // 设置二级路由
      children: [
        {
          name: "xinwen",
          path: "/home/message",
          component: Message,
          // 设置三级路由
          children: [
            {
              name: "xiangqing",
              // query传递
              // path: "/home/message/detail",
              // params
              path: "/home/message/detail/:id/:title/:content?",
              component: Detail,
            },
          ],
          
        },
        {
          name: "xinxi",
          path: "/home/news",
          component: News,
        },
        // 设置默认的选择项
        {
          path:'',
          component:News
        }
      ],
    },
    // 配置默认的
    {
      path: "/",
      component: About,
    },
  ],
});
